<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<!-- 上传插件 -->
<link rel="stylesheet"
	href="/ajax/plugins/bootstrap-fileinput/css/fileinput.css"
	th:href="@{/ajax/plugins/bootstrap-fileinput/css/fileinput.css}" />
<link href="/css/font-awesome.css" th:href="@{/css/font-awesome.css}"
	rel="stylesheet" />


<!--使用code mirror创建一个web代码编辑器 -->
<!--Code Mirror必须引入这两个-->
<link rel="stylesheet" href="/ajax/libs/codemirror-5.31.0/lib/codemirror.css"
	th:href="@{/ajax/libs/codemirror-5.31.0/lib/codemirror.css}" />
<script src="/ajax/libs/codemirror-5.31.0/lib/codemirror.js"
	th:src="@{/ajax/libs/codemirror-5.31.0/lib/codemirror.js}"></script>
<!--Java代码高亮必须引入-->
<script src="/ajax/libs/codemirror-5.31.0/clike.js"
	th:src="@{/ajax/libs/codemirror-5.31.0/clike.js}"></script>
<!--groovy代码高亮-->
<script src="/ajax/libs/codemirror-5.31.0/mode/groovy/groovy.js"
	th:src="@{/ajax/libs/codemirror-5.31.0/mode/groovy/groovy.js}"></script>
<!--引入css文件，用以支持主题-->
<link rel="stylesheet" href="/ajax/libs/codemirror-5.31.0/theme/dracula.css"
	th:href="@{/ajax/libs/codemirror-5.31.0/theme/dracula.css}" />

<!--支持代码折叠-->
<link rel="stylesheet"
	href="/ajax/libs/codemirror-5.31.0/addon/fold/foldgutter.css"
	th:href="@{/ajax/libs/codemirror-5.31.0/addon/fold/foldgutter.css}" />
<script src="/ajax/libs/codemirror-5.31.0/addon/fold/foldcode.js"
	th:src="@{/ajax/libs/codemirror-5.31.0/addon/fold/foldcode.js}"></script>
<script src="/ajax/libs/codemirror-5.31.0/addon/fold/foldgutter.js"
	th:src="@{/ajax/libs/codemirror-5.31.0/addon/fold/foldgutter.js}"></script>
<script src="/ajax/libs/codemirror-5.31.0/addon/fold/brace-fold.js"
	th:src="@{/ajax/libs/codemirror-5.31.0/addon/fold/brace-fold.js}"></script>
<script src="/ajax/libs/codemirror-5.31.0/addon/fold/comment-fold.js"
	th:src="@{/ajax/libs/codemirror-5.31.0/addon/fold/comment-fold.js}"></script>
<!--括号匹配-->
<script src="/ajax/libs/codemirror-5.31.0/addon/edit/matchbrackets.js"
	th:src="@{/ajax/libs/codemirror-5.31.0/addon/edit/matchbrackets.js}"></script>
<!--end Code Mirror -->
<meta charset="utf-8">
<head th:include="include :: header">
</head>
<link href="/rzblog/css/RZBlog.css"
	th:href="@{/rzblog/css/RZBlog.css}" rel="stylesheet" />
<link href="/ajax/libs/jquery-layout/jquery.layout-latest.css"
	th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}"
	rel="stylesheet" />
<link href="/ajax/libs/iCheck/custom.css"
	th:href="@{/ajax/libs/iCheck/custom.css}" rel="stylesheet" />
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-spiderJavaCodeExample-edit">
			<input id="basesetId" name="basesetId" type="hidden"
				th:value="${baseset.basesetId}"><input
				id="spiderJavaCodeExample" name="spiderJavaCodeExample"
				th:value="${baseset.spiderJavaCodeExample}" type="hidden">
			<div class="form-group">
				<label class="col-sm-2 control-label">编辑方式：</label>
				<div class="col-sm-8">
					<label class="checkbox-inline i-checks" id="clickLabel1"> <input
						type="radio" name="toolCodeType" value="0" id="radio1"
						checked="checked" /> 在线编辑
					</label> <label class="checkbox-inline i-checks" id="clickLabel2">
						<input type="radio" name="toolCodeType" value="1" id="radio2" />
						JAVA文件上传
					</label>
				</div>
			</div>
			<div class="form-group" id="show1">
				<!-- <div>
					<lable>提示：JAVA示例代码不允许带包名</lable>
				</div> -->
				<label class="col-sm-2 control-label">示例代码：</label>
				<div>
					<textarea class="form-control" id="code" name="code"></textarea>
				</div>
			</div>
			<div class="form-group" style="display: none" id="show2">
				<label class="col-sm-2 control-label">上传文件：</label>
				<div class="col-sm-8">
					<input id="file-5" class="file" type="file" name="file">
				</div>
			</div>
			<div class="text-right form-group">
				<button class="btn btn-primary" type="submit">保存</button>
				<button th:onclick="'javascript:layer_close()'"
					class="btn btn-danger" type="button">关闭</button>
			</div>
		</form>
	</div>

	<div th:include="include::footer"></div>

	<script src="/ajax/plugins/bootstrap-fileinput/js/fileinput.min.js"
		th:src="@{/ajax/plugins/bootstrap-fileinput/js/fileinput.min.js}"></script>
	<script src="/ajax/plugins/bootstrap-fileinput/js/locales/zh.js"
		th:src="@{/ajax/plugins/bootstrap-fileinput/js/locales/zh.js  }"></script>
	<script src="/ajax/plugins/bootstrap-fileinput/js/locales/fr.js"
		th:src="@{/ajax/plugins/bootstrap-fileinput/js/locales/fr.js  }"></script>

	<script src="/ajax/libs/jquery-layout/jquery.layout-latest.js"
		th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
	<script src="/ajax/libs/iCheck/icheck.min.js"
		th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
	<script>
		$(document).ready(function() {
			$(".i-checks").iCheck({
				checkboxClass : "icheckbox_square-green",
				radioClass : "iradio_square-green",
			})
		});
	</script>
	<script
		src="/rzblog/tool/baseset/detailedit/spiderJavaCodeExampleEdit.js"
		th:src="@{/rzblog/tool/baseset/detailedit/spiderJavaCodeExampleEdit.js}">
		
	</script>
	<script>
		var codeString;
		// 上传文件
		$("#file-5").fileinput(
				{
					language : 'zh', // 设置语言
					uploadUrl : ctx + "tool/baseset/detailedit/uploadFile/"
							+ $('#basesetId').val() + "/0",
					allowedFileExtensions : [ 'java', 'txt' ],// 接收的文件后缀
					showUpload : true, // 是否显示上传按钮
					showCaption : false,// 是否显示标题
					browseClass : "btn btn-primary", // 按钮样式
					dropZoneEnabled : true,//是否显示拖拽区域
					uploadAsync : true,
					showBrowse : true,
					browseOnZoneClick : false,
					maxFileCount : 1, // 表示允许同时上传的最大文件个数
					enctype : 'multipart/form-data',
					maxFileSize : 1000
				// 单位为kb，如果为0表示不限制文件大小
				}).on("fileuploaded", function(event, data) {
			//返回文件内容
			codeString = (data.response.code == 0) ? (data.response.msg) : "";
			//直接将值填入文本框
			selectFileOnline();
			editor.setValue("");
			editor.setValue(codeString);
		});
	</script>
</body>
</html>
